//
//  BaseTableViewController.swift
//  微博
//
//  Created by Mr.Deng on 15/9/23.
//  Copyright © 2015年 Mr.Deng. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController {
   
    var visitorView:VisitorLoginView?
    var userLogin = false
    override func loadView() {
        userLogin ? super.loadView() : setupVisitorView()
    }
    
    @objc private func visitorViewDidRegister(){
        print("注册")
    }
    @objc private func visitorViewDidLogin()
    {
        print("登录")
    }
    
    private func setupVisitorView(){
        visitorView = VisitorLoginView()
        view = visitorView
        visitorView?.registerBtn.addTarget(self, action: "visitorViewDidRegister", forControlEvents: UIControlEvents.TouchUpInside)
        visitorView?.loginBtn.addTarget(self, action: "visitorViewDidLogin", forControlEvents: UIControlEvents.TouchUpInside)
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style:  .Plain, target: self, action: "visitorViewDidRegister")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style:  .Plain, target: self, action: "visitorViewDidLogin")
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()

    }

    
}
